package com.softservecom.training.shop.pojos;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Products entity.
 * 
 * @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "Products", schema = "dbo", catalog = "Java")
public class Products implements java.io.Serializable {

	// Fields

	private Integer productId;
	private Users users;
	private Manufactues manufactues;
	private ProductsCategories productsCategories;
	private String productName;
	private Double price;
	private Integer count;
	private String state;
	private Integer varranty;
	private String description;
	private Set<Orders> orderses = new HashSet<Orders>(0);
	private Set<Images> imageses = new HashSet<Images>(0);

	// Constructors

	/** default constructor */
	public Products() {
	}

	/** minimal constructor */
	public Products(Integer productId, Users users, Manufactues manufactues,
			ProductsCategories productsCategories, String productName,
			Double price, Integer count, String state) {
		this.productId = productId;
		this.users = users;
		this.manufactues = manufactues;
		this.productsCategories = productsCategories;
		this.productName = productName;
		this.price = price;
		this.count = count;
		this.state = state;
	}

	/** full constructor */
	public Products(Integer productId, Users users, Manufactues manufactues,
			ProductsCategories productsCategories, String productName,
			Double price, Integer count, String state, Integer varranty,
			String description, Set<Orders> orderses, Set<Images> imageses) {
		this.productId = productId;
		this.users = users;
		this.manufactues = manufactues;
		this.productsCategories = productsCategories;
		this.productName = productName;
		this.price = price;
		this.count = count;
		this.state = state;
		this.varranty = varranty;
		this.description = description;
		this.orderses = orderses;
		this.imageses = imageses;
	}

	// Property accessors
	@Id
	@Column(name = "ProductID", unique = true, nullable = false)
	public Integer getProductId() {
		return this.productId;
	}

	public void setProductId(Integer productId) {
		this.productId = productId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "UserID", nullable = false)
	public Users getUsers() {
		return this.users;
	}

	public void setUsers(Users users) {
		this.users = users;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ManufactureID", nullable = false)
	public Manufactues getManufactues() {
		return this.manufactues;
	}

	public void setManufactues(Manufactues manufactues) {
		this.manufactues = manufactues;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ProductCategoryID", nullable = false)
	public ProductsCategories getProductsCategories() {
		return this.productsCategories;
	}

	public void setProductsCategories(ProductsCategories productsCategories) {
		this.productsCategories = productsCategories;
	}

	@Column(name = "ProductName", nullable = false, length = 50)
	public String getProductName() {
		return this.productName;
	}

	public void setProductName(String productName) {
		this.productName = productName;
	}

	@Column(name = "Price", nullable = false, scale = 4)
	public Double getPrice() {
		return this.price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	@Column(name = "Count", nullable = false)
	public Integer getCount() {
		return this.count;
	}

	public void setCount(Integer count) {
		this.count = count;
	}

	@Column(name = "State", nullable = false, length = 50)
	public String getState() {
		return this.state;
	}

	public void setState(String state) {
		this.state = state;
	}

	@Column(name = "Varranty")
	public Integer getVarranty() {
		return this.varranty;
	}

	public void setVarranty(Integer varranty) {
		this.varranty = varranty;
	}

	@Column(name = "Description")
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "products")
	public Set<Orders> getOrderses() {
		return this.orderses;
	}

	public void setOrderses(Set<Orders> orderses) {
		this.orderses = orderses;
	}

	@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	@JoinTable(name = "ProductImages", schema = "dbo", catalog = "Java", joinColumns = { @JoinColumn(name = "ProductID", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "ImageID", nullable = false, updatable = false) })
	public Set<Images> getImageses() {
		return this.imageses;
	}

	public void setImageses(Set<Images> imageses) {
		this.imageses = imageses;
	}

}